import Vue from 'vue'
import VueI18n from 'vue-i18n'
import locale from 'element-ui/lib/locale'
import elementEN from 'element-ui/lib/locale/lang/en'
import elementZH from 'element-ui/lib/locale/lang/zh-CN'
import customEN from './en'
import customZH from './zh'

Vue.use(VueI18n)

const messages = {
  en: {
    ...elementEN,
    ...customEN
  },
  zh: {
    ...elementZH,
    ...customZH
  }
}

const i18n = new VueI18n({
  locale: 'en', // 设置语言地区
  messages // 设置语言地区信息
})
// 配置 elementUI 语言转换关系
locale.i18n((key, value) => i18n.t(key, value))

export default i18n
